/**
 * 
 */
package vista.domain;

import java.awt.Color;
import java.awt.Graphics;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JComponent;

import vista.ventanas.PanelPizarra;
import domain.Papa;

/**
 * @author De La
 *
 */
public class PapaVisual extends JComponent implements Observer {
	
	private Papa papa;

	/**
	 * @param papa
	 */
	public PapaVisual(Papa papa) {
		super();
		this.papa = papa;
		paint( PanelPizarra.getInstance().getGraphics() );
	}

	/* (non-Javadoc)
	 * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
	 */
	public void update(Observable arg0, Object arg1) {
		paint( PanelPizarra.getInstance().getGraphics() );
	}
	
	@Override
	public void paint(Graphics g) {
		g.setColor( new Color (200,0,0) ); //TODO color de papas
		g.fillOval(getPapa().getPosicion().x-getPapa().getRadio(),
				getPapa().getPosicion().y-getPapa().getRadio(), 
				getPapa().getRadio()*2+1, getPapa().getRadio()*2+1);
	}
	
	/**
	 * @return the papa
	 */
	public Papa getPapa() {
		return papa;
	}

	/**
	 * @param papa the papa to set
	 */
	public void setPapa(Papa papa) {
		this.papa = papa;
	}

}
